fix(repair): pick_freshest compares commit_ts; add latest-commit-wins example#152
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughChangesThe repair executor now reads freshness keys from row data or Spock metadata. Unit and integration tests cover commit timestamps and application columns, while documentation adds a reusable multi-table latest-wins plan. Freshest-side repair behavior
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
pick_freshest resolved its `key` only from the stripped diff row, but
commit_ts (and other spock metadata) are moved into n1Meta/n2Meta during
diff loading. So `pick_freshest: {key: commit_ts}` found nil on both sides
and fell back to `tie` every time, never actually comparing timestamps.
Resolve the key via lookupValue, which falls back to the metadata map, so
`key: commit_ts` compares commit timestamps while ordinary data columns
(e.g. updated_at) keep working.
Tests:
- unit: commit_ts-from-meta (both directions), one-side-null (the side with
a timestamp wins), both-null (tie), and app-column-from-row.
- integration: one-pass latest-commit-wins end-to-end (newer commit_ts side
wins) and pick_freshest by an app-level column (subscription_date).
Add examples/repair-plan-latest-wins.yaml (fully commented, one-pass pick_freshest by commit_ts, shared across tables via a YAML anchor, with opt-in alternatives and a per-table override) and a "5g" section to advanced-repair-examples.md documenting the pattern, per-case resolution, and the caveats: positional n1/n2, track_commit_timestamp, string comparison, last-write-wins, and when commit_ts actually goes NULL.
a2b5256 to
4aa7174
Compare
pick_freshest with key: commit_ts never actually compared commit timestamps — it read the key from the stripped diff row (where commit_ts has been moved into spock_metadata), found nil on both sides, and fell back to tie every time. This fixes it and documents a one-pass "latest commit wins" repair pattern.
Changes
Notes